import React, { Component } from 'react';
import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom'
import Index from "./components/index/Index";
import Category from "./components/category/Category";
import Cart from "./components/cart/Cart";
import My from "./components/my/My";
import WorthBuy from "./components/worthBuy/WorthBuy"
import Tabbar from "./components/tabbar/Tabbar";
import SearchCenter from "./components/searchCenter/SearchCenter";
import GoodDetail from "./components/goodDetail/GoodDetail";
import GoodList from "./components/goodList/GoodList"
import Pay from "./components/pay/Pay"
import Login from "./components/login/Login";
import Register from "./components/register/Register";
import Address from "./components/address/Address";
import CateList from "./components/cateList/cateList"
import SearchRes from "./components/searchRes/SearchRes";
import Personal from "./components/personal/Personal";
import Order from "./components/orders/Orders"
import Profile from "./components/profile/Profile"
import Endearment from "./components/endearment/Endearment"
import Collect from "./components/colllect/Collect"


export default class RouterConfig extends Component {
  render() {
    return (
      <Router>
        <Switch>
          <Route path='/' exact render={(props) => <Tabbar><Index {...props}></Index></Tabbar>}></Route>
          <Route path='/category' exact render={(props) => <Tabbar><Category {...props}></Category></Tabbar>}></Route>
          <Route path='/cart' exact render={(props) => <Cart {...props}></Cart>}></Route>
          <Route path='/worthBuy' exact render={(props) => <Tabbar><WorthBuy {...props}></WorthBuy></Tabbar>}></Route>
          <Route path='/my' exact render={(props) => <Tabbar><My {...props}></My></Tabbar>}></Route>
          <Route path='/searchcenter' exact render={(props) => <SearchCenter {...props}></SearchCenter>}></Route>
          <Route path='/searchres/:goods_name' exact render={(props) => <SearchRes {...props}></SearchRes>}></Route>
          <Route path='/goodDetail/' exact render={(props) => <GoodDetail {...props}></GoodDetail>}></Route>
          <Route path='/goodList/:goods_name' exact render={(props) => <GoodList {...props}></GoodList>}></Route>
          <Route path='/pay/:addressId' exact render={(props) => <Pay {...props}></Pay>}></Route>
          <Route path="/login/:history" exact render={(props) => <Login {...props}></Login>}></Route>
          <Route path="/register" exact render={(props) => <Register {...props}></Register>}></Route>
          <Route path="/address" exact render={(props) => <Address {...props}></Address>}></Route>
          <Route path="/cateList:id" exact render={(props) => <CateList {...props}></CateList>}></Route>
          <Route path="/personal" exact render={(props) => <Personal {...props}></Personal>}></Route>
          <Route path="/order" exact render={(props) => <Order {...props}></Order>}></Route>
          <Route path="/profile" exact render={(props) => <Profile {...props}></Profile>}></Route>
          <Route path="/endemrment" exact render={(props) => <Endearment {...props}></Endearment>}></Route>
          <Route path="/collect" exact render={(props) => <Collect {...props}></Collect>}></Route>
          <Redirect to='/'></Redirect>
        </Switch>
      </Router>
    );
  }
}